<?php

namespace app\controller;
use app\model\Manager as ManagerModel;
use app\BaseController;

class Index
{
    public function index()
    {
        return 'asdf';
    }

    public function work()
    {
        return 'sadfasdf';
//        $M = new ManagerModel();
//        $res=$M->find(38);
        return showSuccess($res);
    }

    public function error()
    {
       $A=[
           'a'=>'1',
           'b'=>'2',
           'c'=>3
       ];
       $B=[
           'a'=>'1',
           'b'=>'2',
           'c'=>3
       ];
       $C=['left'=>$A,'right'=>json($B)];
       return json($C);
        //抛出异常
//        abort(400,'我是故意的');
//        ApiException('oyjy',123,404);

        $list = [1, 2, 3, 4, 5];
        return showSuccess($list);
//        return showError();
    }

    public function hello($name = 'ThinkPHP6')
    {
        return 'hello,' . $name;
    }
}
